package spring;

import junit.framework.Assert;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

//省略import
public class DependencyInjectWithAnnotationTest {
  private static String configLocation = "classpath:dependecyInjectWithAnnotation.xml";
  private static ApplicationContext ctx = new ClassPathXmlApplicationContext(configLocation);
  //1、Spring自带依赖注入注解
   @Test
  public void testRequiredForXmlSetterInject() {
//      TestBean testBean = ctx.getBean("testBean", TestBean.class);
//      Assert.assertEquals("hello", testBean.getMessage());
  }
   
   @Test
	public void testQualifierInject3() throws InterruptedException {
	    TestBean34 testBean34 = ctx.getBean("testBean34", TestBean34.class);
	    Assert.assertEquals(ctx.getBean("mysqlDataSourceBean"), testBean34.getMysqlDataSource());
	    Assert.assertEquals(ctx.getBean("oracleDataSource"), testBean34.getOracleDataSource());
	    Thread.sleep(60000);
	}
}
